   
var popups = chrome.extension.getViews({type: "popup"});
function loadPage() {
  console.log("Loading page...");
  location.search.substring(1).match(/^id=(.*)$/);
  var docID =  RegExp.$1;
  console.log(docID);
  if (popups.length != 0) {
  var popup = popups[0];
  popup.getPageCon(docID,
    function(resp) {
      var docContent = resp.content;
      console.log(docContent);
      var dataURL = 'data:text/html;charset=utf-8,' + encodeURI(docContent);
      location.replace(dataURL);
    });
}
}
loadPage();
